package cn.jhg.account.service;

import java.util.List;
import java.util.Map;
import java.util.HashMap;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import cn.jhg.account.entity.Equipment;

import cn.jhg.account.util.ServiceResult;

import cn.jhg.account.persist.EMDao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Service("emSvc")
@Transactional
public class EMSvcImpl implements EMSvc {
	
	@Resource
	private EMDao emDao ;
	
	private Logger logger = LoggerFactory.getLogger(UserSvcImpl.class);

	@Override
	public ServiceResult<List<Equipment>> findEMs(String em_name) {
		
		ServiceResult<List<Equipment>> result=new ServiceResult<List<Equipment>>();

		
		logger.info(em_name);
		
		try{
			
			List<Equipment> ems = emDao.findEMs(em_name);
			
			result.setErrorCode(0);
			result.setData(ems);
		}
		catch (Exception e)
		{
			result.setErrorCode(221707168);
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
		}
		
		return result;
	}

}
